package com.ygxsk.carhome.views;

import android.content.Context;
import android.util.AttributeSet;

import androidx.appcompat.widget.AppCompatEditText;

/**
 * Autuhor:Administrator
 * Time:2019/5/16 0016  15:55
 * Description: this is
 */
//@SuppressLint("AppCompatCustomView")
//public class LastInputEditText extends EditText {
public class LastInputEditText extends AppCompatEditText {

    public LastInputEditText(Context context) {
        super(context);
    }

    public LastInputEditText(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public LastInputEditText(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onSelectionChanged(int selStart, int selEnd) {
        super.onSelectionChanged(selStart, selEnd);
        //保证光标始终在最后面
        if (selStart == selEnd) {//防止不能多选
            setSelection(getText().toString().trim().length());
        }

    }

//        ---------------------
//                作者：Mr__Han_
//        来源：CSDN
//        原文：https://blog.csdn.net/u011135662/article/details/51453021
//        版权声明：本文为博主原创文章，转载请附上博文链接！

}
